unit Lists;

interface

  type
    PElement = ^TElement;
    TElement = record
      value: integer;
      next: PElement;
    end;

    PElement2 = ^TElement2;
    TElement2 = record
      value1, value2: integer;
      next: PElement2;
    end;

  procedure Init( head: PElement ); overload;
  procedure Init( head: PElement2 );overload;

  procedure PrintList( head: PElement ); overload;
  procedure PrintList( head: PElement2 );overload;

 { procedure AddToEnd( head: PElement; num: integer );        overload;
  procedure AddToEnd( head: PElement2; num1, num2: integer );overload;

  procedure AddToBegin( head: PElement; num: integer );        overload;
  procedure AddToBegin( head: PElement2; num1, num2: integer );overload; }

implementation

  procedure Init( head: PElement );
  begin
    new( head );
    head^.next := nil;
  end;

  procedure Init( head: PElement2 );
  begin
    new( head );
    head^.next := nil;
  end;

  procedure PrintList( head: PElement );  //override;      -----  Print list  -----
  var
    Current: PElement;
  begin
    current := head;
    While current <> nil do begin
      writeln( current^.value );
      current := current^.next;
    end;
  end;

  procedure PrintList( head: PElement2 );  //override;      -----  Print list  -----
  var
    Current: PElement2;
  begin
    current := head;
    While current <> nil do begin
      writeln( current^.value1, ' ', current^.value2 );
      current := current^.next;
    end;
  end;

end.
 